<?php

declare(strict_types=1);

namespace App\Api\Request;

use Mine\MineFormRequest;

class StaffRequest extends MineFormRequest
{
    public function loginRules(): array
    {
        return [
            'phone' => 'required|string|size:11|regex:/^1\d{10}$/',
            'password' => 'required|string',
        ];
    }

    public function updatePersonalRules(): array
    {
        return [
            'avatar' => 'required|string|max:255|url',
            'name' => 'required|string|max:10',
            'phone' => 'required|string|size:11|regex:/^1\d{10}$/|unique:staffs,phone,' . $this->route('id'),
        ];
    }

    public function attributes(): array
    {
        return [
            'phone' => '手机号',
            'password' => '密码',
            'avatar' => '头像',
            'name' => '姓名',
        ];
    }
}
